Add support for deriving major modes in which-func
authorDamien Cassou <damien@cassou.me>
Wed, 7 Feb 2024 19:41:44 +0000 (20:41 +0100)
committerStefan Kangas <stefankangas@gmail.com>
Sat, 10 Feb 2024 11:01:53 +0000 (12:01 +0100)
* lisp/progmodes/which-func.el (which-func-try-to-enable)
(which-func-ff-hook): Use `derived-mode-p' to check if the current major
mode is within `which-func-modes' or `which-func-non-auto-modes'.
(Bug#68981)

lisp/progmodes/which-func.el

index bd68672f9058cd1c5fefb36336b528a6b0257302..631cb3b0aef75d8c39ada56d7c9afda290f57a8b 100644 (file)
@@ -211,7 +211,7 @@ non-nil.")
   (when which-function-mode
     (unless (local-variable-p 'which-func-mode)
       (setq which-func-mode (or (eq which-func-modes t)
-                                (member major-mode which-func-modes)))
+                                (apply #'derived-mode-p which-func-modes)))
       (setq which-func--use-mode-line
             (member which-func-display '(mode mode-and-header)))
       (setq which-func--use-header-line
@@ -239,7 +239,7 @@ It creates the Imenu index for the buffer, if necessary."
 
   (condition-case err
       (if (and which-func-mode
-              (not (member major-mode which-func-non-auto-modes))
+              (not (apply #'derived-mode-p which-func-non-auto-modes))
               (or (null which-func-maxout)
                   (< buffer-saved-size which-func-maxout)
                   (= which-func-maxout 0)))